//package com.note.config;
//
//import org.springframework.beans.factory.config.PropertiesFactoryBean;
//import org.springframework.core.io.Resource;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//
//import java.io.File;
//import java.util.Map;
//import java.util.Properties;
//
///**
// * @author Xiongx
// * @version 1.0
// * @date 2021/4/30 23:36
// * @since JDK 1.8
// */
//public class NoteUtils {
//
//    public static void loadProperties(String propertiesName, Map<String, String> stringStringMap) {
//        // 获得PathMatchingResourcePatternResolver对象
//        PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
//        try {
//            // 加载resource文件(也可以加载resources)
//            Resource resources = resolver.getResource("classpath:"+propertiesName+".properties");
//            PropertiesFactoryBean config = new PropertiesFactoryBean();
//            config.setLocation(resources);
//            config.afterPropertiesSet();
//            Properties prop = config.getObject();
//            // 循环遍历所有得键值对并且存入集合
//            for (String key : prop.stringPropertyNames()) {
//                stringStringMap.put(key, (String) prop.get(key));
//            }
//        } catch (Exception e) {
//            new Exception("配置文件加载失败");
//        }
//    }
//
//    public static String getSystemPath(){
//        String sysPath=System.getProperty("user.dir");
//        Map<String, String> object=SpringContextUtil.getBeanObj("notepro");
//        String projectName=object.get("projectName");
//        String path=object.get("path");
//        String[] strings=path.split("-");
//        StringBuilder stringBuilder=new StringBuilder();
//        stringBuilder.append(sysPath);
//        stringBuilder.append(File.separator);
//        stringBuilder.append(projectName);
//        for (int i = 0; i < strings.length; i++) {
//            stringBuilder.append(File.separator).append(strings[i]);
//        }
//        return stringBuilder.toString();
//    }
//
//
//
//    public static File getFilePath(String fileName){
//        PathMatchingResourcePatternResolver resolver =new PathMatchingResourcePatternResolver();
//        File file=null;
//        try {
//            Resource resources = resolver.getResource("classpath:"+fileName);
//            file=resources.getFile();
//        }catch (Exception e){
//            e.printStackTrace();
//        }
//        return file;
//    }
//
//}
